import { validStr } from "../../utils/util"

// components/debtor-info-list/debtor-info-list.ts
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    item: {
      type: Object,
      value: {
        title: '',
        val: '',
        sectitle: '',
        secval: '',
        isShowLine: false,
        style: '',
        secstyle: '',
        ishorizontal: false
      }
    },
    customTitleStyle: {
      type: String,
      value: ''
    },
    customValStyle: {
      type: String,
      value: ''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    title: '',
    val: '',
    sectitle: '',
    secval: '',
    isShowLine: false,
    style: '',
    secstyle: ''
  },

  lifetimes: {
    ready() {
      const blankSymbol = ["/", "、", "空", "[]", '0', "***********|***********|***********|***********|"]
      this.setData({
        title: validStr(this.properties.item.title),
        val: validStr(this.properties.item.val, '-', blankSymbol),
        sectitle: validStr(this.properties.item.sectitle, ''),
        secval: validStr(this.properties.item.secval, '-', blankSymbol),
        isShowLine: this.properties.item.isShowLine || false
      })
    }
  }
})